package com.lewis.xuanke.controller;

import com.lewis.xuanke.entity.ComResult;
import com.lewis.xuanke.utils.QRCodeUtil;
import org.springframework.web.bind.annotation.*;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;

/**
 * <p>QRCodeController</p>
 *
 * @author lvhaosir6
 * @version 1.0.0
 * @date 2020/7/10
 */
@RestController
@RequestMapping("/qrcode")
public class QRCodeController {
    /**
     *
     */
    @RequestMapping(value = "/getQr", method = RequestMethod.POST)
    public ComResult getQRCode(String content) {
        ComResult<String> result = new ComResult<>();
        String time = System.currentTimeMillis() + "";
        String base64QRCode = QRCodeUtil.getBase64QRCode(content + ";" + time, "");
        result.setData(base64QRCode);
        result.setCode(0);
        return result;
    }
}